package eteam.aps.gateway.client;

import eteam.aps.common.QueryResult;
import eteam.aps.common.R;
import eteam.aps.common.exceptions.AuthException;
import eteam.aps.systeminterface.model.dto.LogDto;
import eteam.aps.systeminterface.model.entity.LogEntity;
import eteam.aps.systeminterface.service.ILogController;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "systemservice", url = "${gateway.system-url}")
public interface SystemLogFeignClient extends ILogController {
    /**
     * 分页查询日志
     *
     * @param token:     Token
     * @param pageIndex: 页码
     * @param pageSize:  每页记录数
     * @param menuid:    检索模块ID
     * @return
     */
    @GetMapping(value = "/api/log/querylogpagelist")
    R<QueryResult<LogEntity>> queryLogPageList(
            @RequestHeader("token") String token,
            @RequestParam("pageIndex") int pageIndex,
            @RequestParam("pageSize") int pageSize,
            @RequestParam("menuid") String menuid
    ) throws Exception, AuthException;

    /**
     * 记录日志
     *
     * @param token:  Token
     * @param logDto: 日志对象
     * @return
     */
    @PostMapping({"/api/log/createlog"})
    R<Object> createLog(
            @RequestHeader("token") String token,
            @RequestBody LogDto logDto
    ) throws Exception, AuthException;
}
